import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/log_utils.dart';
import 'package:yt_devops/model/device_model.dart';
import 'package:yt_devops/pages/devices/device_list/device_list_model.dart';
import '../component/dynamic_tabview.dart';
import 'device_base_info_widget_controller.dart';

class DeviceBaseInfoWidgetPage extends GetView<DeviceBaseInfoWidgetController> {
  final DeviceModel? deviceModel;
  final List<int> subDevicesIdList; //设备详情ems需要订阅的子设备
  final List<String> subDevicesNameList; //设备详情ems需要订阅的子设备名称
  final DeviceListModel? deviceTree;
  DeviceBaseInfoWidgetPage(
      {required this.deviceModel,
      required this.subDevicesIdList,
      required this.subDevicesNameList,
      this.deviceTree,
      Key? key})
      : super(key: key);

  @override
  final DeviceBaseInfoWidgetController controller =
      Get.put<DeviceBaseInfoWidgetController>(DeviceBaseInfoWidgetController());
  @override
  Widget build(BuildContext context) {
    return GetBuilder<DeviceBaseInfoWidgetController>(
        initState: (state) {
          controller.deviceModel = deviceModel;
          controller.deviceTree = deviceTree;
          if (deviceModel != null) {
            controller.initData(deviceModel!);
          }
        },
        builder: (_) => DynamicTabView(controller.baseInfoList));
  }
}
